class CreateGroupSpaces < ActiveRecord::Migration
  def self.up
    create_table :group_spaces do |t|
      t.references :group
      t.references :academic_space

      t.timestamps
    end
    add_index(:group_spaces, [:group_id, :academic_space_id], :unique => true)
    add_index(:group_spaces, :group_id, :academic_space_id => false)
  end

  def self.down
    remove_index(:group_spaces, [:group_id, :academic_space_id])
    remove_index(:group_spaces, :group_id)
    drop_table :group_spaces
  end
end
